﻿using Styx;
using Styx.WoWInternals;
using WuzzCollection.Helpers;

namespace WuzzCollection.Classes
{
    internal partial class Hunter : AbstractClass
    {
        public override void ApproachAndFaceTarget()
        {
            if (Me.CurrentTarget.Distance >= 40 || !Me.CurrentTarget.InLineOfSpellSight)
            {
                Styx.Pathing.Navigator.MoveTo(Me.CurrentTarget.Location);
            }

            if (Me.CurrentTarget.Distance < 40 && Me.CurrentTarget.InLineOfSpellSight)
            {
                WoWMovement.MoveStop();
                WoWMovement.ConstantFace(Me.CurrentTarget.Guid);
            }
        }

        public override bool NeedPreCombatBuffs()
        {
            return false;
        }

        public override void PreCombatBuffs()
        {
            
        }

        public override bool CastHeal()
        {
            // Mend Pet
            if (Me.Pet.IsAlive && Me.Pet.HealthPercent <= 75 && !Me.Pet.HasAura("Mend Pet") && Me.Pet.Distance < 45 && Me.Pet.InLineOfSpellSight)
            {
                if (Spell.CastHeal("Mend Pet")) { return true; }
            }
            return false;
        }

        public override bool CastDefensiveSpells()
        {
            return false;
        }

        public override bool CastInterrupt()
        {
            return false;
        }

        public override void Pull()
        {
            ApproachAndFaceTarget();
            AutoAttack();
        }

        public override void AutoAttack()
        {
            if (!Me.IsAutoAttacking)
            {
                Lua.DoString("StartAttack()");
            }
        }

        public override void RunRotation()
        {
            if (Me.Level < 10)
            {
                LowbieRotation();
            }
            else
            {
                switch (Me.Specialization)
                {
                    case WoWSpec.HunterBeastMastery:
                        BeastmasterRotation();
                        break;
                    default:
                        LowbieRotation();
                        break;
                }
            }
        }
    }
}